<?
  require_once '../classes/ConnectionDB.php';

  $db = ConnectionDB::getInstance()->connectToDB();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Ricerca classi</title>
      <script src="../glassboxLatest/glassbox.2.0.0/javascripts/prototype.js" type="text/javascript"></script>
      <script src="../glassboxLatest/glassbox.2.0.0/javascripts/scriptaculous/effects.js" type="text/javascript"></script>
      <script src="../glassboxLatest/glassbox.2.0.0/javascripts/glassbox/glassbox.js" type="text/javascript"></script>
      <style type="text/css">
        @import url("../css/style.css");

        #testForm {
          padding-top: 3%;
          margin-left: -5px;
        }

        #testFormCont
        {
          padding-left: 2%;
          padding-top: 3%;
        }

        #testFormCont table
        {

        }


      </style>
      <script type="text/javascript">
        path_to_root_dir = "../glassboxLatest/glassbox.2.0.0/";
        var listaClassi;
        window.onload = function()
        {
          var testForm = new GlassBox();
          testForm.init( 'testForm', '540px', '190px', 'hidden','',true, false);
          testForm.ipos();
          testForm.appear();
        }

        function handlerClassi()
        {
          if(this.readyState == 4 && this.status == 200)
          {
            //          alert("resp : " + this.responseText);
            var resp = eval(this.responseText);
            listaClassi = new Array();
            if(resp!=null)
            {
              var str="";
              for(i=0;i<resp.length; i++)
              {
                listaClassi[i] = resp[i];

                str +='<option value="'+listaClassi[i].codice+'">'+listaClassi[i].classe + " "+listaClassi[i].sezione+ " "+ listaClassi[i].descrizioneIndirizzo+'</option>';
                document.getElementById("classe").innerHTML=str;
              }
            }
          }
        }
        function xXMLHttpRequest()
        {  
  
          var client = null;  
          if (window.XMLHttpRequest)  
          {  
            client=new XMLHttpRequest();  
          }  
          // code for IE  
          else if (window.ActiveXObject)  
          {  
            client=new ActiveXObject("Microsoft.XMLHTTP");  
          }  
  
          return client;  
        }  

        function loadClassi()
        {
          var client = xXMLHttpRequest();
          client.onreadystatechange = handlerClassi;

          var param = "operation=loadClassi";
          client.open("POST", "../report/searchStudentsListener.php", true);
          client.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

          client.send(param);
        }


      </script>
    </head>
    <body>
    <?php include '../portal/header.php'; ?>
      <center>
        <div id="testForm">
          <div id="testFormCont">
            <form method="POST" action="manageClasse.php">

              <table cellpadding="6" style="display: inline; padding-top: 2%;">
                <tr>
                  <th>Classe : </th>
                  <td>
                    <select name="classe" id="classe">
                     
                    </select>
                  </td>
                <script>loadClassi();</script>
              <tr>
                <td colspan="2"></td>
                <td><input type="submit" value="Cerca" /></td>
              </tr>
            </table>
          </form>
        </div>
      </div>
    </center>
  </body>
</html>
